﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MensUnoShop.Models
{
    public class MarketSearch
    {
        private string _marketname;
        private string _marketsn;
        private string _keyword;
        private int _truetopprice;
        private int _truedownprice;
        private long _tagid;
        private DBMarket _dal;

        public MarketSearch(string keyword)
        {
            _marketname = string.Empty;
            _marketsn = string.Empty;
            _keyword = keyword;
            _truetopprice = 0;
            _truedownprice = 0;
            _tagid = 0;
        }
        public MarketSearch(string marketname, string marketsn, string keyword, int topprice, int downprice, long tagid)
        {
            _marketname = marketname;
            _marketsn = marketsn;
            _keyword = keyword;
            _truetopprice = topprice;
            _truedownprice = downprice;
            _tagid = tagid;
        }

        

        public List<SimpleMarket> GetResult()
        {
            setRepository();
            List<SimpleMarket> list = new List<SimpleMarket>();
            list = _dal.GetSearchResult(_keyword);
            return list;
        }

        public string GetSearchString()
        {
            return string.Empty;
        }

        private void setRepository()
        {
            if (_dal == null)
                _dal = new DBMarket();
        }
    }
}